<!DOCTYPE HTML PUBLIC "-//ORA//DTD CD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>[Chapter 12] Runtime</TITLE>
<META NAME="author" CONTENT="Mark Grand and Jonathan Knudsen">
<META NAME="date" CONTENT="Fri Aug  8 17:04:19 1997">
<META NAME="form" CONTENT="html">
<META NAME="metadata" CONTENT="dublincore.0.1">
<META NAME="objecttype" CONTENT="book part">
<META NAME="otheragent" CONTENT="gmat dbtohtml">
<META NAME="publisher" CONTENT="O'Reilly &amp; Associates, Inc.">
<META NAME="source" CONTENT="SGML">
<META NAME="subject" CONTENT="Java">
<META NAME="title" CONTENT="Java Fundamental Classes Reference">
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
</HEAD>
<body vlink="#551a8b" alink="#ff0000" text="#000000" bgcolor="#FFFFFF" link="#0000ee">

<DIV CLASS=htmlnav>
<H1><a href='index.htm'><IMG SRC="gifs/smbanner.gif"
     ALT="Java Fundamental Classes Reference" border=0></a></H1>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch12_50.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><B><FONT FACE="ARIEL,HELVETICA,HELV,SANSERIF" SIZE="-1">Chapter 12<br>The java.lang Package</FONT></B></TD>
<td width=172 align=right valign=top><A HREF="ch12_52.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
</table>

&nbsp;
<hr align=left width=515>
</DIV>
<DIV CLASS=refnamediv>
<H1>Runtime</H1>

<H2>Name</H2>

Runtime

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch12-REFSECT1-AUTOID.327">Synopsis</A></h2>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Class Name:<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>java.lang.Runtime</tt>

<p>
<DT CLASS=varlistentry>Superclass:<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>java.lang.Object</tt>

<p>
<DT CLASS=varlistentry>Immediate Subclasses:<br>
<DD>

<P CLASS=para>
None

<p>
<DT CLASS=varlistentry>Interfaces Implemented:<br>
<DD>

<P CLASS=para>
None

<p>
<DT CLASS=varlistentry>Availability:<br>
<DD>

<P CLASS=para>
JDK 1.0 or later</DL>
</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch12-REFSECT1-AUTOID.328">Description</A></h2>

<P CLASS=para>
<A NAME="MAN.RUNTIME.1"></A><A NAME="MAN.RUNTIME.2"></A>The <tt CLASS=literal>Runtime</tt> class provides access to various
information about the environment in which a program is running.
The Java run-time environment creates a single instance of this class
that is associated with a program. The <tt CLASS=literal>Runtime</tt>
class does not have any public constructors, so a program cannot
create its own instances of the class. A program must call the <tt CLASS=literal>getRuntime()</tt>
method to get a reference to the current <tt CLASS=literal>Runtime</tt> object.

<P CLASS=para>
Information about operating system features is accessible
through the <tt CLASS=literal>System</tt> class.

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch12-REFSECT1-AUTOID.329">Class Summary</A></h2>

<DIV CLASS=screen>
<P>
<PRE>
public class java.lang.Runtime extends java.lang.Object {
    // Class Methods
    public static Runtime getRuntime();
    public static void runFinalizersOnExit(boolean value);  // New in 1.1
    // Instance Methods
    public Process exec(String command);
    public Process exec(String command, String envp[]);
    public Process exec(String cmdarray[]);
    public Process exec(String cmdarray[], String envp[]);
    public void exit(int status);
    public native long freeMemory();
    public native void gc();
    public InputStream 
           getLocalizedInputStream(InputStream in);      // Deprecated in 1.1
    public OutputStream 
           getLocalizedOutputStream(OutputStream out);   // Deprecated in 1.1
    public synchronized void load(String filename);
    public synchronized void loadLibrary(String libname);
    public native void runFinalization();
    public native long totalMemory();
    public native void traceInstructions(boolean on);
    public native void traceMethodCalls(boolean on);
}
</PRE>
</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch12-REFSECT1-AUTOID.330">Class Methods</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch12-REFSECT2-AUTOID.310">getRuntime</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch12-REFSECT3-AUTOID.378"><tt CLASS=literal>public static Runtime getRuntime()</tt></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
A reference to the current <tt CLASS=literal>Runtime</tt> object.

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns a reference to the current <tt CLASS=literal>Runtime</tt>
object. Because the other methods of the <tt CLASS=literal>Runtime</tt>
class are not <tt CLASS=literal>static</tt>, a program must call this
method first in order to get a reference to a <tt CLASS=literal>Runtime</tt>
object that can be used in calling the other methods.</DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch12-REFSECT2-AUTOID.311">runFinalizersOnExit</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch12-REFSECT3-AUTOID.379"><tt CLASS=literal>public static void runFinalizersOnExit(boolean value)</tt></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Availability<br>
<DD>

<P CLASS=para>
New as of JDK 1.1

<p>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>value</tt><br>
<DD>

<P CLASS=para>
A <tt CLASS=literal>boolean</tt> value that specifies whether or not
finalization occurs on exit.</DL>
<p>
<DT CLASS=varlistentry>Throws<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>SecurityException</tt><br>
<DD>

<P CLASS=para>
If the <tt CLASS=literal>checkExit()</tt> method of
the <tt CLASS=literal>SecurityManager</tt> throws a <tt CLASS=literal>SecurityException</tt>.</DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method specifies whether or not the <tt CLASS=literal>finalize()</tt> 
methods of all objects that have <tt CLASS=literal>finalize()</tt> methods
are run before the Java virtual machine exits.  By default, the
finalizers are not run on exit.  </DL>
</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch12-REFSECT1-AUTOID.331">Instance Methods</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch12-REFSECT2-AUTOID.312">exec</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch12-REFSECT3-AUTOID.380"><tt CLASS=literal>public Process exec(String command) throws IOException</tt></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>command</tt><br>
<DD>

<P CLASS=para>
A string that contains the name of an external command
and any arguments to be passed to it.</DL>
<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
A <tt CLASS=literal>Process</tt> object that controls the process
started by this method.

<p>
<DT CLASS=varlistentry>Throws<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>IOException</tt><br>
<DD>

<P CLASS=para>
If there is a problem finding or accessing the specified
external command.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>SecurityException</tt><br>
<DD>

<P CLASS=para>
If the <tt CLASS=literal>checkExec()</tt> method of
the <tt CLASS=literal>SecurityManager</tt> throws a <tt CLASS=literal>SecurityException</tt>.</DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method starts a new process to execute the given external
command. The standard input, standard output, and standard error
streams from the process are redirected to
<tt CLASS=literal>OutputStream</tt> and
<tt CLASS=literal>InputStream</tt> objects that are accessible
through the <tt CLASS=literal>Process</tt> object returned by this method.

<P CLASS=para>
Calling this method is equivalent to:

<DIV CLASS=screen>
<P>
<PRE>
exec(command, null)
</PRE>
</DIV>

</DL>
</DIV>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch12-REFSECT3-AUTOID.381"><DIV CLASS=screen> <P> <PRE> public Process exec(String command, String[] envp) throws IOException </PRE> </DIV></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>command</tt><br>
<DD>

<P CLASS=para>
A string that contains the name of an external command
and any arguments to be passed to it.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>envp</tt><br>
<DD>

<P CLASS=para>
An array of strings that specifies the values for
the environment variables of the new process.
Each <tt CLASS=literal>String</tt> in the array
should be of the form <I CLASS=emphasis>variableName</I> =<I CLASS=emphasis>value</I>.
If <tt CLASS=literal>envp</tt> is <tt CLASS=literal>null</tt>, the values
of the environment variables in the current process are copied to
the new process.</DL>
<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
A <tt CLASS=literal>Process</tt> object that controls the process
started by this method.

<p>
<DT CLASS=varlistentry>Throws<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>IOException</tt><br>
<DD>

<P CLASS=para>
If there is a problem finding or accessing the specified
external command.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>SecurityException</tt><br>
<DD>

<P CLASS=para>
If the <tt CLASS=literal>checkExec()</tt> method of
the <tt CLASS=literal>SecurityManager</tt> throws a <tt CLASS=literal>SecurityException</tt>.</DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method starts a new process to execute the given external
command. The standard input, standard output, and standard error
streams from the process are redirected to
<tt CLASS=literal>OutputStream</tt>
and <tt CLASS=literal>InputStream</tt> objects that are accessible
through the <tt CLASS=literal>Process</tt> object returned by this method.

<P CLASS=para>
The method parses the <tt CLASS=literal>command</tt> string into
words that are separated by whitespace. It creates a <tt CLASS=literal>String</tt>
object for each word and places word <tt CLASS=literal>String</tt> objects
into an array. If that array is called <tt CLASS=literal>commandArray</tt>,
calling this method is equivalent to:

<DIV CLASS=screen>
<P>
<PRE>
exec(commmandArray, envp)
</PRE>
</DIV>

</DL>
</DIV>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch12-REFSECT3-AUTOID.382"><DIV CLASS=screen> <P> <PRE> public Process exec(String[] commandArray) throws IOException </PRE> </DIV></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>commandArray</tt><br>
<DD>

<P CLASS=para>
An array of strings that contains separate strings
for the name of an external command and any arguments to be passed
to it. The first string in the array must be the command name.</DL>
<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
A <tt CLASS=literal>Process</tt> object that controls the process
started by this method.

<p>
<DT CLASS=varlistentry>Throws<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>IOException</tt><br>
<DD>

<P CLASS=para>
If there is a problem finding or accessing the specified
external command.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>SecurityException</tt><br>
<DD>

<P CLASS=para>
If the <tt CLASS=literal>checkExec()</tt> method of
the <tt CLASS=literal>SecurityManager</tt> throws a <tt CLASS=literal>SecurityException</tt>.</DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method starts a new process to execute the given external
command. The standard input, standard output, and standard error
streams from the process are redirected to <tt CLASS=literal>OutputStream</tt>
and <tt CLASS=literal>InputStream</tt> objects that are accessible
through the <tt CLASS=literal>Process</tt> object returned by this method.

<P CLASS=para>
Calling this method is equivalent to:

<DIV CLASS=screen>
<P>
<PRE>
exec(commandArray, null)
</PRE>
</DIV>

</DL>
</DIV>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch12-REFSECT3-AUTOID.383"><DIV CLASS=screen> <P> <PRE> public Process exec(String[] commandArray, String[] envp) throws IOException </PRE> </DIV></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>commandArray</tt><br>
<DD>

<P CLASS=para>
An array of strings that contains separate strings
for the name of an external command and any arguments to be passed
to it. The first string in the array must be the command name.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>envp</tt><br>
<DD>

<P CLASS=para>
An array of strings that specifies the values for
the environment variables of the new process.
Each <tt CLASS=literal>String</tt> in the array
should be of the form <I CLASS=emphasis>variableName</I> =<I CLASS=emphasis>value</I>.
If <tt CLASS=literal>envp</tt> is <tt CLASS=literal>null</tt>, the values
of the environment variables in the current process are copied to
the new process.</DL>
<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
A <tt CLASS=literal>Process</tt> object that controls the process
started by this method.

<p>
<DT CLASS=varlistentry>Throws<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>IOException</tt><br>
<DD>

<P CLASS=para>
If there is a problem finding or accessing the specified
external command.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>SecurityException</tt><br>
<DD>

<P CLASS=para>
If the <tt CLASS=literal>checkExec()</tt> method of
the <tt CLASS=literal>SecurityManager</tt> throws a <tt CLASS=literal>SecurityException</tt>.</DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method starts a new process to execute the given external
command. The standard input, standard output, and standard error
streams from the process are redirected to <tt CLASS=literal>OutputStream</tt>
and <tt CLASS=literal>InputStream</tt> objects that are accessible
through the <tt CLASS=literal>Process</tt> object returned by this method.</DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch12-REFSECT2-AUTOID.313">exit</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch12-REFSECT3-AUTOID.384"><tt CLASS=literal>public void exit(int status)</tt></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>status</tt><br>
<DD>

<P CLASS=para>
The exit status code to use.</DL>
<p>
<DT CLASS=varlistentry>Throws<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>SecurityException</tt><br>
<DD>

<P CLASS=para>
If the <tt CLASS=literal>checkExit()</tt> method of
the <tt CLASS=literal>SecurityManager</tt> throws a <tt CLASS=literal>SecurityException</tt>.</DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method causes the Java virtual machine
to exit with the given status code. By convention,
a nonzero status code indicates abnormal termination. This method
never returns.</DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch12-REFSECT2-AUTOID.314">freeMemory</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch12-REFSECT3-AUTOID.385"><tt CLASS=literal>public native long freeMemory()</tt></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
An estimate of the number of free bytes in system memory.

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns an estimate of the number of free bytes
in system memory. The value returned by this method is always less
than the value returned by <tt CLASS=literal>totalMemory()</tt>. Additional
memory may be freed by calling the <tt CLASS=literal>gc()</tt> method.</DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch12-REFSECT2-AUTOID.315">gc</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch12-REFSECT3-AUTOID.386"><tt CLASS=literal>public native void gc()</tt></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method causes the Java virtual machine to run the garbage
collector in the current thread.

<P CLASS=para>
The garbage collector finds objects that will never be used
again because there are no live references to them. After it finds
these objects, the garbage collector frees the storage occupied
by these objects.

<P CLASS=para>
The garbage collector is normally run continuously in a thread
with the lowest possible priority, so that it works intermittently
to reclaim storage. The <tt CLASS=literal>gc()</tt> method allows a
program to invoke the garbage collector explicitly when necessary.</DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch12-REFSECT2-AUTOID.316">getLocalizedInputStream</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch12-REFSECT3-AUTOID.387"><tt CLASS=literal>public InputStream getLocalizedInputStream(InputStream in)</tt></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Availability<br>
<DD>

<P CLASS=para>
Deprecated as of JDK 1.1

<p>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>in</tt><br>
<DD>

<P CLASS=para>
An <tt CLASS=literal>InputStream</tt> object that is
to be localized.</DL>
<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The localized <tt CLASS=literal>InputStream</tt>.

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns an <tt CLASS=literal>InputStream</tt> object
that converts characters from the local character set to Unicode.
For example, if the <tt CLASS=literal>InputStream</tt> uses an 8-bit
character set with values less than 128 representing Cyrillic letters,
this method maps those characters to the corresponding 

Unicode characters
in the range <tt CLASS=literal>'\u0400'</tt> to <tt CLASS=literal>'\u04FF'</tt>.

<P CLASS=para>
This method is deprecated as of JDK 1.1.  You should instead use the
new <tt CLASS=literal>InputStreamReader</tt> and 
<tt CLASS=literal>BufferedReader</tt> classes to convert characters from
the local character set to Unicode.</DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch12-REFSECT2-AUTOID.317">getLocalizedOutputStream</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch12-REFSECT3-AUTOID.388"><tt CLASS=literal>public OutputStream getLocalizedOutputStream(OutputStream out)</tt></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Availability<br>
<DD>

<P CLASS=para>
Deprecated as of JDK 1.1

<p>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>out</tt><br>
<DD>

<P CLASS=para>
An <tt CLASS=literal>OutputStream</tt> object that is
to be localized.</DL>
<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The localized <tt CLASS=literal>OutputStream</tt>.

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns an <tt CLASS=literal>OutputStream</tt> object
that converts characters from Unicode to the local character set.
For example, if the local character set is an 8-bit character set
with values less than 128 representing Cyrillic letters, this method
maps Unicode characters in the range <tt CLASS=literal>'\u0400'</tt>
to <tt CLASS=literal>'\u04FF'</tt> to the appropriate characters in
the local character set.

<P CLASS=para>
This method is deprecated as of JDK 1.1.  You should instead use the
new <tt CLASS=literal>OutputStreamWriter</tt> and 
<tt CLASS=literal>BufferedWriter</tt> classes to convert characters from
Unicode to the local character set.</DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch12-REFSECT2-AUTOID.318">load</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch12-REFSECT3-AUTOID.389"><tt CLASS=literal>public synchronized void load(String filename)</tt></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>filename</tt><br>
<DD>

<P CLASS=para>
A string that specifies the complete path of the
file to be loaded.</DL>
<p>
<DT CLASS=varlistentry>Throws<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>SecurityException</tt><br>
<DD>

<P CLASS=para>
If the <tt CLASS=literal>checkLink()</tt> method of
the <tt CLASS=literal>SecurityManager</tt> throws a <tt CLASS=literal>SecurityException</tt>.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>UnsatisfiedLinkError</tt><br>
<DD>

<P CLASS=para>
If the method is unsuccessful in loading the specified
dynamically linked library.</DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method loads the specified dynamically linked library.

<P CLASS=para>
It is often more convenient to call the <tt CLASS=literal>load()</tt>
method of the <tt CLASS=literal>System</tt> class because it does not
require getting a <tt CLASS=literal>Runtime</tt> object.</DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch12-REFSECT2-AUTOID.319">loadLibrary</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch12-REFSECT3-AUTOID.390"><tt CLASS=literal>public synchronized void loadLibrary(String libname)</tt></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>libname</tt><br>
<DD>

<P CLASS=para>
A string that specifies the name of a dynamically linked
library.</DL>
<p>
<DT CLASS=varlistentry>Throws<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>SecurityException</tt><br>
<DD>

<P CLASS=para>
If the <tt CLASS=literal>checkLink()</tt> method of
the <tt CLASS=literal>SecurityManager</tt> throws a <tt CLASS=literal>SecurityException</tt>.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>UnsatisfiedLinkError</tt><br>
<DD>

<P CLASS=para>
If the method is unsuccessful in loading the specified
dynamically linked library.</DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method loads the specified dynamically linked library.
It looks for the specified library in a platform-specific way.

<P CLASS=para>
It is often more convenient to call the <tt CLASS=literal>loadLibrary()</tt>
method of the <tt CLASS=literal>System</tt> class because it does not
require getting a <tt CLASS=literal>Runtime</tt> object.</DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch12-REFSECT2-AUTOID.320">runFinalization</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch12-REFSECT3-AUTOID.391"><tt CLASS=literal>public native void runFinalization()</tt></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
  
This method causes the Java virtual machine to run the <tt CLASS=literal>finalize()</tt>
methods of any objects in the finalization queue in the current
thread.

<P CLASS=para>
When the garbage collector discovers that there are no references
to an object, it checks to see if the object has a <tt CLASS=literal>finalize()</tt>
method that has never been called. If the object has such a <tt CLASS=literal>finalize()</tt>
method, the object is placed in the finalization queue. While there
is a reference to the object in the finalization queue, the object
is no longer considered garbage-collectable.

<P CLASS=para>
Normally, the objects in the finalization queue are handled
by a separate finalization thread that runs continuously at a very
low priority. The finalization thread removes an object from the
queue and calls its <tt CLASS=literal>finalize()</tt> method. As long
as the <tt CLASS=literal>finalize()</tt> method does not generate a
reference to the object, the object again becomes available for
garbage collection.

<P CLASS=para>
Because the finalization thread runs at a very low priority,
there may be a long delay from the time that an object is put on
the finalization queue until the time that its <tt CLASS=literal>finalize()</tt>
method is called. The <tt CLASS=literal>runFinalization()</tt> method
allows a program to run the <tt CLASS=literal>finalize()</tt> methods
explicitly. This can be useful when there is a shortage of some
resource that is released by a <tt CLASS=literal>finalize()</tt> method.</DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch12-REFSECT2-AUTOID.321">totalMemory</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch12-REFSECT3-AUTOID.392"><tt CLASS=literal>public native long totalMemory()</tt></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The total number of bytes in system memory.

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns the total number of bytes in system memory
in the Java virtual machine. The total includes the number of bytes
of memory being used by allocated objects, as well as the number
of free bytes available for allocating additional objects. An estimate
of the number of free bytes in system memory is available through
the <tt CLASS=literal>freeMemory()</tt> method.</DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch12-REFSECT2-AUTOID.322">traceInstructions</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch12-REFSECT3-AUTOID.393"><tt CLASS=literal>public native void traceInstructions(boolean on)</tt></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>on</tt><br>
<DD>

<P CLASS=para>
A <tt CLASS=literal>boolean</tt> value that specifies
if instructions are to be traced. <tt CLASS=literal>true</tt> if instructions
are to be traced; otherwise <tt CLASS=literal>false</tt>.</DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method controls whether or not the Java virtual machine
outputs a detailed trace of each instruction that is executed. The
<tt CLASS=literal>boolean</tt> parameter causes tracing to be turned
on or off. The tracing of instructions is only possible in a Java
virtual machine that was compiled with the tracing option enabled.
Production releases of the Java virtual machine are generally not
compiled with tracing enabled.</DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch12-REFSECT2-AUTOID.323">traceMethodCalls</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch12-REFSECT3-AUTOID.394"><tt CLASS=literal>public native void traceMethodCalls(boolean on)</tt></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>on</tt><br>
<DD>

<P CLASS=para>
A <tt CLASS=literal>boolean</tt> value that specifies
if method calls are to be traced. <tt CLASS=literal>true</tt> if instructions
are to be traced; otherwise <tt CLASS=literal>false</tt>.</DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method controls whether or not the Java virtual machine
outputs a detailed trace of each method that is invoked. The <tt CLASS=literal>boolean</tt>
parameter causes tracing to be turned on or off. The tracing of
instructions is only possible in a Java virtual machine that was
compiled with the tracing option enabled. Production releases of
the Java virtual machine are generally not compiled with tracing
enabled.</DL>
</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch12-REFSECT1-AUTOID.332">Inherited Methods</A></h2>

<DIV CLASS=informaltable>
<P>
<TABLE CLASS=INFORMALTABLE>
<TR CLASS=row>
<TH ALIGN="left">

<P CLASS=para>
Method</TH>
<TH ALIGN="left">

<P CLASS=para>
Inherited From</TH>
<TH ALIGN="left">

<P CLASS=para>
Method</TH>
<TH ALIGN="left">

<P CLASS=para>
Inherited From</TH>
</TR>
<TR CLASS=row>
<TD ALIGN="left">

<P CLASS=para>
<tt CLASS=literal>clone()</tt></TD>
<TD ALIGN="left">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
<TD ALIGN="left">

<P CLASS=para>
<tt CLASS=literal>equals(Object)</tt></TD>
<TD ALIGN="left">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
</TR>
<TR CLASS=row>
<TD ALIGN="left">

<P CLASS=para>
<tt CLASS=literal>finalize()</tt></TD>
<TD ALIGN="left">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
<TD ALIGN="left">

<P CLASS=para>
<tt CLASS=literal>getClass()</tt></TD>
<TD ALIGN="left">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
</TR>
<TR CLASS=row>
<TD ALIGN="left">

<P CLASS=para>
<tt CLASS=literal>hashCode()</tt></TD>
<TD ALIGN="left">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
<TD ALIGN="left">

<P CLASS=para>
<tt CLASS=literal>notify()</tt></TD>
<TD ALIGN="left">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
</TR>
<TR CLASS=row>
<TD ALIGN="left">

<P CLASS=para>
<tt CLASS=literal>notifyAll()</tt></TD>
<TD ALIGN="left">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
<TD ALIGN="left">

<P CLASS=para>
<tt CLASS=literal>toString()</tt></TD>
<TD ALIGN="left">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
</TR>
<TR CLASS=row>
<TD ALIGN="left">

<P CLASS=para>
<tt CLASS=literal>wait()</tt></TD>
<TD ALIGN="left">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
<TD ALIGN="left">

<P CLASS=para>
<tt CLASS=literal>wait(long)</tt></TD>
<TD ALIGN="left">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
</TR>
<TR CLASS=row>
<TD ALIGN="left">

<P CLASS=para>
<tt CLASS=literal>wait(long, int)</tt></TD>
<TD ALIGN="left">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
<TD ALIGN="left">&nbsp;</TD>
<TD ALIGN="left">&nbsp;</TD>
</TR>
</TABLE>
<P>
</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch12-REFSECT1-AUTOID.333">See Also</A></h2>

<P CLASS=para>
<tt CLASS=literal>IOException</tt>, 
<tt CLASS=literal>Object</tt>, 
<tt CLASS=literal>Process</tt>, 
<tt CLASS=literal>SecurityException</tt>, 
<tt CLASS=literal>SecurityManager</tt>, 
<tt CLASS=literal>System</tt>,
<tt CLASS=literal>UnsatisfiedLinkError</tt>
</DIV>


<DIV CLASS=htmlnav>

<P>
<HR align=left width=515>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch12_50.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><a href="index.htm"><img src='gifs/txthome.gif' border=0 alt='Home'></a></td>
<td width=172 align=right valign=top><A HREF="ch12_52.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
<tr>
<td width=172 align=left valign=top>Runnable</td>
<td width=171 align=center valign=top><a href="index/idx_0.htm"><img src='gifs/index.gif' alt='Book Index' border=0></a></td>
<td width=172 align=right valign=top>RuntimeException</td>
</tr>
</table>
<hr align=left width=515>

<IMG SRC="gifs/smnavbar.gif" USEMAP="#map" BORDER=0> 
<MAP NAME="map"> 
<AREA SHAPE=RECT COORDS="0,0,108,15" HREF="../javanut/index.htm"
alt="Java in a Nutshell"> 
<AREA SHAPE=RECT COORDS="109,0,200,15" HREF="../langref/index.htm" 
alt="Java Language Reference"> 
<AREA SHAPE=RECT COORDS="203,0,290,15" HREF="../awt/index.htm" 
alt="Java AWT"> 
<AREA SHAPE=RECT COORDS="291,0,419,15" HREF="../fclass/index.htm" 
alt="Java Fundamental Classes"> 
<AREA SHAPE=RECT COORDS="421,0,514,15" HREF="../exp/index.htm" 
alt="Exploring Java"> 
</MAP>
</DIV>

</BODY>
</HTML>
